package com.xinqi.modules.prepare.prepare.manager;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xinqi.common.mybatis.data.service.BaseService;
import com.xinqi.modules.prepare.common.domain.PrepareBaseParam;
import com.xinqi.modules.prepare.prepare.domain.PrepareMemberEntity;
import com.xinqi.modules.prepare.prepare.domain.PrepareOperateLogEntity;
import com.xinqi.modules.prepare.prepare.dto.req.PrepareOperateLogQueryDTO;
import com.xinqi.modules.prepare.prepare.dto.rsp.PrepareOperateLogResultDTO;
import com.xinqi.modules.prepare.prepare.enums.PrepareMemberRoleEnum;
import com.xinqi.modules.prepare.prepare.enums.PrepareOperateLogEnum;
import com.xinqi.modules.prepare.prepare.enums.PrepareOperateTypeEnum;
import com.xinqi.modules.prepare.prepare.enums.PrepareSubOperateTypeEnum;
import com.xinqi.modules.prepare.prepare.enums.PrepareTypeEnum;
import com.xinqi.modules.prepare.question.domain.PrepareQuestionBankEntity;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 备课区操作记录表管理层
 *
 * @author: system
 * @date: 2023/03/19
 */
public interface PrepareOperateLogManager extends BaseService<PrepareOperateLogEntity> {

    /**
     * 自定义分页查询
     */
    Page<PrepareOperateLogResultDTO> findPage(Page<Object> page, PrepareOperateLogQueryDTO query);

    /**
     * 自定义列表查询
     */
    List<PrepareOperateLogResultDTO> findList(PrepareOperateLogQueryDTO query);

    /**
     * 根据id查询 备课区操作记录表数据
     */
    PrepareOperateLogEntity findById(Long id);

    /**
     * 根据id删除 备课区操作记录表数据
     */
    @Transactional(rollbackFor = Exception.class)
    boolean deleteById(Long id);

    @Transactional(rollbackFor = Exception.class)
    boolean addFileOperateLog(PrepareBaseParam prepareBase,
                              PrepareOperateTypeEnum operateType,
                              PrepareSubOperateTypeEnum operateSubType);

    @Transactional(rollbackFor = Exception.class)
    boolean addFileOperateLog(PrepareBaseParam prepareBase,
                              PrepareOperateLogEnum operateType);

    @Transactional(rollbackFor = Exception.class)
    boolean addFileOperateLog(Long prepareId,
                              PrepareTypeEnum type,
                              Long operator,
                              PrepareOperateTypeEnum operateType,
                              PrepareSubOperateTypeEnum operateSubType,
                              Long targetId,
                              String targetName);

    @Transactional(rollbackFor = Exception.class)
    boolean addMemberOperateLog(PrepareMemberEntity member,
                                PrepareOperateLogEnum logEnum,
                                PrepareMemberRoleEnum beforeRole,
                                PrepareMemberRoleEnum afterRole);

    @Transactional(rollbackFor = Exception.class)
    boolean addMemberOperateLog(PrepareMemberEntity member,
                                PrepareOperateTypeEnum operateType,
                                PrepareSubOperateTypeEnum operateSubType,
                                PrepareMemberRoleEnum beforeRole,
                                PrepareMemberRoleEnum afterRole);

    @Transactional(rollbackFor = Exception.class)
    boolean addMemberOperateLog(Long prepareId,
                                Long operator,
                                PrepareOperateTypeEnum operateType,
                                PrepareSubOperateTypeEnum operateSubType,
                                Long targetId,
                                String targetName,
                                PrepareMemberRoleEnum beforeRole,
                                PrepareMemberRoleEnum afterRole);

    @Transactional(rollbackFor = Exception.class)
    boolean addQuestionOperateLog(PrepareQuestionBankEntity entity,
                                  PrepareOperateTypeEnum operateType,
                                  PrepareSubOperateTypeEnum operateSubType);

    @Transactional(rollbackFor = Exception.class)
    boolean addQuestionOperateLog(PrepareQuestionBankEntity entity,
                                  PrepareOperateLogEnum logEnum);


    @Transactional(rollbackFor = Exception.class)
    boolean addQuestionOperateLog(Long prepareId,
                                  Long operator,
                                  PrepareOperateTypeEnum operateType,
                                  PrepareSubOperateTypeEnum operateSubType,
                                  Long targetId,
                                  String targetName);

    @Transactional(rollbackFor = Exception.class)
    boolean addLog(Long prepareId,
                   PrepareTypeEnum type,
                   Long operator,
                   PrepareOperateTypeEnum operateType,
                   PrepareSubOperateTypeEnum operateSubType,
                   Long targetId,
                   String targetName,
                   PrepareMemberRoleEnum beforeRole,
                   PrepareMemberRoleEnum afterRole);
}
